{*
 * This file is part of the Agora distribution. 
 * Detailed copyright and licensing information can be found
 * in the gpl-3.0.txt file which should be included in the distribution.
 * 
 * @version		$Id: 3.0.14 Olympus 2010-09-28 rammstein4o $
 * @copyright  2007 - 2010 jVitals
 * @license   GPLv3 Open Source
 * @link       http://jvitals.com
 * @since      File available since initial release
 *}
{*<div class="ag_innerwrap">
	<p>$paging_links</p>
</div>*}

{if $show_as == 'topics'}
<div class="ag_postlinksTop">
	<div class="ag_inbox">
		<div class="ag_pagelink">
			{include file=agora:include/paginate.tpl}
		</div>
	</div>
</div>

<div class="ag_rightend">
	<h2 class="ag_headerbar">
		<span class="ag_middle">
			{if $smarty.get.action == "show_latest"}
			##Show latest posts##
			{elseif $smarty.get.action == "show_unanswered"}
			##Show Unanswered Posts##
			{elseif $smarty.get.action == "show_unreaded"}
			##Show Unreaded Posts##
			{else}
			##Search results##: ##Show as topics##
			{/if}
		</span>
	</h2>
</div>

<div class="ag_tablewrap">
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<thead>
			<tr>
				<th class="ag_leftend">&nbsp;</th>
				<th class="ag_spacer">&nbsp;</th>
				<th class="ag_column">##Topic##</th>
				<th class="ag_topic">##Stats##</th>
				{if isset($search_result.0.score)}
				<th class="ag_lastpost">##Last post##</th>
				<th class="ag_topic3">##Relevancy##</th>
				{else}
				<th class="ag_lastpost">##Last post##</th>
				{/if}
			</tr>
		</thead>
		<tbody>
			{foreach from=$search_result item=topic key=topic_num}
				{include file=agora:include/topic_row.tpl}
			{foreachelse}
			<tr>
				<td class="ag_spacer ag_userlist_empty" colspan="5">##No hits##</td>
			</tr>
			{/foreach}
		</tbody>
	</table>
</div>
<div class="ag_postlinksBottom">
	<div class="ag_inbox">
		<div class="ag_pagelink">
			{include file=agora:include/paginate.tpl}
		</div>
	</div>
</div>
<div class="ag_clearer"></div>

{*<div class="ag_innerwrap">
	<p>$paging_links</p>
</div>*}

{elseif $show_as == 'posts'}
<div class="ag_postlinksTop">
	<div class="ag_inbox">
		<div class="ag_pagelink">
			{include file=agora:include/paginate.tpl}
		</div>
	</div>
</div>

<div class="ag_rightend">
	<h2 class="ag_headerbar"><span class="ag_middle">##Search results##: ##Show as posts##</span></h2>
</div>

{foreach from=$search_result item=post key=post_count}
{cycle values='roweven,rowodd' assign=vtbg}

<div class="ag_outerwrap ag_blockpost{$vtbg}">
	<!-- post header -->
	<div class="ag_rightend">
		<div class="ag_headerbar">
			<span class="ag_middle">
				<span class="ag_postnum">
					##Forum##: <a href="{url task=forum id=$post.forum_id}">{$post.forum_name}</a>
				</span>
				<span class="ag_postdate">
					<a href="{url task=topic id=$post.tid}#p{$post.pid}">{$post.pposted|agora_date}</a>
				</span>
			</span>
		</div>
	</div>
	<!-- /post header -->
	<!-- post content -->
	<div>
		<div class="ag_postrow {if $agora_config.o_userdata eq 0}ag_left_column{elseif $agora_config.o_userdata eq 1}ag_right_column{/if}">
			<div class="ag_postrow_container">
				<div class="ag_postrow_wrap">
					<div class="ag_postrow_col1">
						<!-- post text -->
						<h3 class="ag_posttitle"><a href="{url task=topic id=$post.tid}">{$post.subject}</a></h3>
						<div class="ag_postmsg">{$post.message|escape}</div>
						<!-- /post text -->
					</div>
				</div>
				<div class="ag_postrow_col2">
					<!-- info  -->
					<div class="ag_avatararea userimg">
						<dl>
							<dt class="ag_username">
								<span class="ag_byuser">
									<strong>##by##</strong><br />
									<a href="{url task=profile id=$post.poster_id}">
										{$post.pposter|nomail|escape}
									</a>
								</span>
							</dt>
							{if isset($post.score)}
							<dd>
								##Relevancy##:
								<span class="ag_post_score">
									{$post.score|string_format:"%.2f"}
								</span>
							</dd>
							{/if}
							<dd>
								<p class="ag_color"><strong>{$post.num_replies}</strong> ##Replies##</p>
							</dd>
							<dd>
								<a href="{url task=topic id=$post.tid}#p{$post.pid}" title="##Go to post##" class="ag_goto_post">
									<strong>##Go to post##</strong>
								</a>
							</dd>
						</dl>
					</div>
					<!-- /info  -->
				</div>
			</div>
		</div>
	</div>
	<!-- /post content -->
</div>
<div class="ag_post_separator"></div>
{foreachelse}
<div class="ag_tablewrap">
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tbody>
			<tr>
				<td class="ag_spacer ag_userlist_empty" colspan="5">##No hits##</td>
			</tr>
		</tbody>
	</table>
</div>
{/foreach}

<div class="ag_postlinksBottom">
	<div class="ag_inbox">
		<div class="ag_pagelink">
			{include file=agora:include/paginate.tpl}
		</div>
	</div>
</div>
<div class="ag_clearer"></div>

{/if}